// 选择排序
let arr = [2,5,84,32,2,45,5,9,1]
for(let i = 0, len=arr.length, min; i < len; i++){
  min = arr[i]
  for(let j = i+1; j<=len; j++){
    if(arr[j] < min){
      let c = min
      min = arr[j]
      arr[j] = c
    }
  }
  arr[i] = min
}
console.log(arr)